<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>demo..</title>
    <script src="../common/vue.min.js" type="text/javascript"></script>
    <style type="text/css">

    </style>
</head>
<body>
<!--view-->


<div id="div_test">
    <my-directive></my-directive>


</div>


<script type="text/javascript">
    var MyPlugin ;

    //TODO error:Uncaught TypeError: Cannot set property 'install' of undefined
    MyPlugin.install = function (Vue, options) {
        //1：添加全局方法或者属性
        Vue.myGlobalMethod = function(){
            console.log("say hello my Global method")
        };
        //2：添加全局资源
        Vue.directive('my-directive', function () {
            console.log("say hi my directive")

        })
        //3:添加实例方法
        Vue.prototype.$myMethod = function(){
            console.log("say hi my prototype method")

        }
    }

    Vue.use(MyPlugin);
//    Vue.use(MyPlugin,{});





</script>

</body>
</html>